﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MyOwnInfo : MonoBehaviour {
    public UILabel nameLabel;
    public UILabel goldLabel;
    public GameObject goldPlus;
    public List<GameObject> betBtns;
    public DNHundredGame dnGame;
    //筹码图标
    public List<GameObject> NoSelectOfActives;
    public List<GameObject> NoSelectOfUnactives;
    //可选的下注图标
    public List<GameObject> SelectBetBtns;
    void Awake()
    {
        UIEventListener.Get(goldPlus).onClick = ButtonClick;
        for (int i = 0; i < betBtns.Count;i++ )
        {
            UIEventListener.Get(betBtns[i]).onClick = ButtonClick;
        }
            
    }

    void ButtonClick(GameObject button)
    {
        if (button.name == "GoldPlus")
        {
            //充值
            GameObject AddMoney = NGUITools.AddChild(GameObject.Find("UI Root").gameObject, (GameObject)(Resources.Load(HallPrafabPath.AddMoney)));
            Add_MoneyModel addMoneyModel = AddMoney.GetComponent<Add_MoneyModel>();
            addMoneyModel.PayForGold.SetActive(true);
            addMoneyModel.PayForRoomCard.SetActive(false);
            addMoneyModel.TransferAccount.SetActive(false);
            addMoneyModel.GoldBtnBg.SetActive(true);
            addMoneyModel.RoomCardBtnBg.SetActive(false);
            addMoneyModel.TransfBtnBg.SetActive(false);
        }
        else if (button.transform.parent.name == "ChipBtn1")
        {
            //金币1
            InitChip();
            NoSelectOfActives[0].SetActive(true);
            NoSelectOfUnactives[0].SetActive(true);
            dnGame.betCoinCount = 100;
        }
        else if (button.transform.parent.name == "ChipBtn2")
        {
            //金币2
            InitChip();
            NoSelectOfActives[1].SetActive(true);
            NoSelectOfUnactives[1].SetActive(true);
            dnGame.betCoinCount = 1000;
        }
        else if (button.transform.parent.name == "ChipBtn3")
        {
            //金币3
            InitChip();
            NoSelectOfActives[2].SetActive(true);
            NoSelectOfUnactives[2].SetActive(true);
            dnGame.betCoinCount = 10000;
        }
        else if (button.transform.parent.name == "ChipBtn4")
        {
            //金币4
            InitChip();
            NoSelectOfActives[3].SetActive(true);
            NoSelectOfUnactives[3].SetActive(true);
            dnGame.betCoinCount = 100000;
        }
        else if (button.transform.parent.name == "ChipBtn5")
        {
            //金币5
            InitChip();
            NoSelectOfActives[4].SetActive(true);
            NoSelectOfUnactives[4].SetActive(true);
            dnGame.betCoinCount = 1000000;
        }
    }

    /// <summary>
    /// 筹码选中状态初始化
    /// </summary>
    void InitChip()
    {
        for (int i = 0; i < NoSelectOfActives.Count;i++ )
        {
            NoSelectOfActives[i].SetActive(false);
            NoSelectOfUnactives[i].SetActive(false);
        }
    }
}
